<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>商品添加页面</h1>
<div>
    <input type="text"placeholder="请输入标题" v-model="p.title">
    <input type="text"placeholder="请输入价格" v-model="p.price">
    <input type="text"placeholder="请输入销量" v-model="p.saleCount">
    <input type="button"value="添加商品"@click="update">
</div>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"div",
        data:{
            p:{
                title:"",price:"",saleCount:""
            }
        },
        methods:{
            update(){
                axios.post("/insert",v.p).then(function (response) {
                     alert("添加商品成功")
                     location.href="/";
                })
            }
        }
    })
</script>
</body>
</html>